<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Form Test</title>
<link rel="stylesheet" href="../css/form.css" type="text/css" />

<script type="text/javascript" src="../liwe.js"></script>
<script type="text/javascript" src="../locale.js"></script>
<script type="text/javascript" src="../utils.js"></script>
<script type="text/javascript" src="../object_enh.js"></script>
<script type="text/javascript" src="../array_enh.js"></script>
<script type="text/javascript" src="../string_enh.js"></script>
<script type="text/javascript" src="../money.js"></script>
<script type="text/javascript" src="../form.js"></script>
<script type="text/javascript" src="../dom.js"></script>
<script type="text/javascript" src="../validators.js"></script>
<script type="text/javascript" src="../locale/it/form.js"></script>

<script type="text/javascript" src="../../os3wwl/wwl.js"></script>
<script type="text/javascript" src="../../os3wwl/popbox/popbox.js"></script>
<script type="text/javascript" src="../../os3wwl/suggest/suggest.js"></script>

<link rel="stylesheet" href="../../os3wwl/popbox/popbox.css" type="text/css" />

<script type="text/javascript">
function do_grid ()
{
	var g = os3grid_get_grid ( 'my_grid' );

	g.add_row ( "Fabio", "Rotondo", "fabio@rotondo.it" );

	g.render ();
}

function test_suggest_init ( dest_id )
{
	console.debug ( "SUGGEST INIT" );

	function request ( txt, cback )
	{
		cback ( [ [ 0, txt ] ] );
	}

	function row_render ( row, is_selected )
        {
                return "<div class=\"label\">" + row [ 0 ] + "</div><div class=\"value\">" + row [ 1 ] + "</div>";
        }

        function row_get_val ( row )
        {
                return row [ 0 ];
        }

	var as = new AutoSuggest ( dest_id );
	
	as.cbacks [ 'request' ] = request;
        as.cbacks [ 'row-render' ] = row_render;
        as.cbacks [ 'row-get-val' ] = row_get_val;
}

function create_form ()
{
	liwe._libbase = "../";
	
	var f = new liwe.form.instance ( 'test' );

	f.text ( { label: "Test suggest", name: "login", akey: 'l', mandatory: true, value: "tua login", suggest: test_suggest_init } );
	f.set ( 'my_form' );
}
</script>
</head> 
<body onload="create_form()">

<div id="my_form"></div>
<div id="my_form2"></div>
<div id="my_form3"></div>



</body>
</html>
